1. Technical Field
The present invention is directed to the field of data storage and retrieval in portable electronic devices typically having limited processing and memory capabilities, such as two-way wireless paging computers, PDAs, P/PCs, H/PCs, etc. More particularly, the present invention provides a portable electronic device having a software-implemented log-structured file system for storing and retrieving data from an electrically-erasable flash memory store. The system preferably stores data in at least one log as a plurality of contiguous variable-length records. The invention also provides memory mapped pointer access to the individual data records. Alternatively, certain implementations of the invention provide: (1) a plurality of logs for storing records that change at different relative frequencies in order to improve system performance; and (2) storing multiple versions of the data records in the log.
2. Description of the Related Art
Portable electronic devices are typically characterized by limited electrical power, limited processing capability and limited storage capacity. Since these devices are portable, they must also be light-weight and small. Thus, it is desirable to provide such a portable electronic device with a memory storage medium that is low power, small in size, high-capacity, and rugged. Semi-conductor chip memories have proven useful in meeting these requirements.
Particularly useful for this application is flash memory. Flash memory is a type of electrically-erasable programmable read-only memory. Flash is a non-volatile memory characterized by a plurality of memory cells implemented with a floating-gate field effect transistor (xe2x80x9cFETxe2x80x9d). An electrical charge can be permanently trapped on the floating gate of the FET, thus effecting a write operation to the memory cell. Trapping a charge on the floating gate (xe2x80x9cprogrammingxe2x80x9d) requires only modestly more time than charging the gate of an FET used in dynamic random access memory (xe2x80x9cRAMxe2x80x9d), and requires no special control circuitry. However, removing the trapped charge (xe2x80x9cerasingxe2x80x9d) takes significantly longer for flash, and requires expensive on-chip circuitry. In currently available flash memories, this erase time may be as much as two orders of magnitude slower than the programming time. As a result, flash manufacturers provide a fine-grain mechanism for imparting charges to the floating gate, perhaps as small as a few bytes at a time, and a coarse-grain mechanism for removing charge from the floating gate, perhaps a block of many kilobytes.
Presently known portable electronic devices have file systems that store data in a flash memory using intermediate block-sized RAM buffers to store active data (i.e., the RAM buffer is at least as large as one block of flash memory). Updates to the data are performed in the RAM buffer. Reads are performed by accessing the RAM buffer. Periodically, the contents of the RAM buffer replaces the contents of the particular flash memory block to which it is temporarily referenced. Another flash block can then be read into the RAM if different data becomes active.
These types of portable electronic devices suffer from many disadvantages. First, these systems are prone to lose data. If important data is stored in the RAM buffer (a volatile storage media) and has not been programmed into the flash device, and power is lost, then the important data is also lost. In order to cure this problem, these devices must flush the RAM buffer(s) to flash memory before committing a transaction, and as a result they typically flush the RAM buffer(s) at frequent rates. But this results in low write-efficiency to the flash memory since a buffer flush requires an erase step and a programming step for the entire flash block. The frequency of flushing the buffer may additionally result in shorter lifetime for the flash, which degrades as the number of erases increases. Secondly, a large amount of RAM is required in these systems since current flash memory devices include large block sizes, typically on the order of 64 Kbytes or greater. The overhead cost in accessing the flash through RAM buffers also extends to applications operating on the portable device. These applications must also maintain RAM buffers in order to read and write to the RAM buffers in the file system. Thus even more RAM is required to support the file system. More RAM results in increased cost and size of the portable electronic device. And finally, these devices typically exhibit low read efficiency because of the overhead in calling the operating system, performing a context switch, possibly changing protection domains, and in trying to decide if the most up to date copy of the data is in RAM or the flash memory.
Therefore, there remains a general need in this field for a portable electronic device having a data storage and retrieval system for storing data in flash memory that overcomes the many disadvantages of the presently known devices.
A portable electronic device is provided that includes a log-structured file system implemented in flash memory. The log-structured file system preferably includes a write function for storing contiguous data records to the flash memory in the form of at least one data log, although alternatively, the system may write data records to the flash memory using a plurality of data logs that may be arranged in parallel, hierarchically, or both. The data records are preferably linked together in a linked-list structure, including a record header for maintaining link data, and the linked records may further form a plurality of files that may also be linked together in a linked-list structure. The log-structured file system also preferably includes a read function for retrieving data records from the one or more logs using a plurality of memory mapped pointers, which may be stored in an associated RAM index, or which may be implemented as an index stored in the flash memory. A clean-log function is also provided for eliminating inactive records from the log so that new data can be added.
The various functions included with the log-structured file system are preferably implemented as at least three software modules, a read module, a write module and a clean-log module, although other modules and configurations are possible. The portable electronic device may further include a two-way RF transceiver for sending and receiving data from the device, and may also include a plurality of application programs that are configured to interact with the log-structured file system and as other software modules for controlling the operation of the portable electronic device.
According to one aspect of the invention, a portable electronic device is provided that includes a microprocessor, an electrically erasable flash memory store, a two-way radio-frequency transceiver, and a log-structured file system for storing data in the flash memory store. In this aspect of the invention, the log-structure file system includes: (a) a write software module for writing data to the flash memory as a sequence of contiguous records; (b) a read software module for reading data from the flash memory using a plurality of memory mapped pointers into the flash memory store; and (c) a clean-log software module for cleaning inactive records from the flash memory store in order to make room for additional data. The microprocessor preferably executes the software modules of the log-structured file system in order to write data to the flash memory, read data from the flash memory, and clean inactive records from the flash memory, and also controls sending and receiving data from the portable electronic device via the two-way radio-frequency transceiver.
Another aspect of the invention provides a portable electronic device including a log-structured file system for storing a log of contiguous data records in a flash memory store, and for reading data from the flash memory store using a plurality of memory mapped pointers that reference the individual data records. Additionally, the plurality of memory mapped pointers may be stored in a RAM associated with the portable electronic device, or they may be stored in an index in the flash memory store. A two-way radio-frequency transceiver for sending and receiving data over a wireless data network is alternatively included.
In another aspect of the invention, a portable electronic device is provided that includes a flash memory store and a log-structured file system for storing a plurality of logs of contiguous data records in the flash memory store, and for reading data from the flash memory store using a plurality of memory mapped pointers that point to the individual data records, wherein at least one of the logs of contiguous data records stores relatively-volatile data records (i.e., those data records that change with relatively high frequency), and at least one other log stores relatively-involatile data records (i.e., those data records that change less frequently than those stored in the first log). Alternatively, the log that stores the relatively-volatile records is termed the xe2x80x9chotxe2x80x9d log, and the log that stores the relatively-involatile records is termed the xe2x80x9ccoldxe2x80x9d log. There may be multiple levels of hot and cold logs depending upon the implementation.
Still another aspect of the invention provides a portable electronic device for sending and receiving data via a wireless digital data network. A device according to this aspect of the invention includes a microprocessor, an electrically erasable flash memory store, a two-way radio-frequency transceiver, and a log-structured file system for storing the data in the flash memory store, the log-structure file system including a write software module, a read software module and a clean-log software module. In this aspect of the invention, the microprocessor executes the software modules of the log-structured file system in order to write data to the flash memory, read data from the flash memory, and clean inactive data from the flash memory, and controls sending and receiving data from the portable electronic device over the wireless digital data network via the two-way radio-frequency transceiver.
Yet another aspect of the invention provides a two-way wireless paging computer, comprising: a microprocessor; an RF transceiver for sending and receiving data; a flash memory store for storing data sent and received by the two-way wireless paging computer; and a log-structured file system under the control of the microprocessor for storing one or more data logs in the flash memory store, the log-structured file system including software modules for writing contiguous data records to the log, for reading data records from the log, and for cleaning the log by removing inactive data records from the log to make room for new data records.
These are just some of the many aspects of the invention that will become apparent from reviewing the detailed description of the drawings, set forth below. Other aspects not specifically noted, or which are insubstantially different, or which include elements that are substantially the same as those shown in the detailed description are within the scope of the present invention.
The present invention overcomes the disadvantages of presently known portable electronic devices storing data in flash memory, and also provides many advantages. Two of the primary advantages of the present invention are improved write efficiency and improved read efficiency. Better write performance is achieved in the present invention by rejecting the traditional paradigm for writing to flash, i.e., through a RAM buffer. This traditional approach to storing data in flash memory disadvantageously selects locations for writes that force an erase to be performed before any write can be committed to memory, thus resulting in a view of flash memory as a storage device with fast read times but slow overall write times. By distinction, the log-structured file system implemented in the present invention divorces erases from writes, resulting in a view of flash memory as a storage device with three operations: fast reads, slightly slower writes, and very slow bulk erases. Using the teaching of the present invention, application programs operating on the portable electronic device can write data on demand, but the system delays the flash memory erase cycle until more convenient time, such as when the device is idle. Thus, application programs and their users do not have to wait through an erase operation, as is generally the case with presently known devices.
Better read efficiency is achieved by also rejecting the paradigm of a RAM buffer. The present invention recognizes that, although flash is used as a non-volatile data storage device like a magnetic disk or tape, it has read characteristics that are similar to RAM, e.g., fine granularity of data to be read and high read speed. Instead of reading through a RAM buffer, the present invention returns a pointer directly into flash that references the record to be accessed. Because the record is contiguous, the application program can then read the data directly from flash by dereferencing the pointer within the length of the record. Using this technique, the present invention eliminates both the transfer time and the overhead time for a context switch necessary with the RAM buffer approach.
Other advantages of the present invention include: (1) operates on less RAM than presently known systems, while maintaining support for applications that manipulate relatively large data files; (2) reduces the potential for data loss caused by a system reset; (3) by storing data as a plurality of contiguous records, the present invention enables applications to reference data using memory mapped pointers into the file system, which also enables easier programming of applications; and (4) retains and, in some cases improves upon, the characteristics desirable in portable electronic devices, such as low power consumption, small size, low weight, and low price.
These are just a few of the many advantages of the present invention, as described in more detail below in terms of the preferred embodiments. As will be appreciated, the invention is capable of other and different embodiments, and its several details are capable of modifications in various respects, all without departing from the spirit of the invention. Accordingly, the drawings and description of the preferred embodiments set forth below are to be regarded as illustrative in nature and not restrictive.